package com.atguigu.newmvc.config;

import com.atguigu.newmvc.Interceptor.HandlerInterceptor1;
import com.atguigu.newmvc.Interceptor.HandlerInterceptor2;
import com.atguigu.newmvc.Interceptor.HandlerInterceptor3;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Component
public class WebMvcConfig implements WebMvcConfigurer {
    @Autowired
    private HandlerInterceptor1 handlerInterceptor1;
    @Autowired
    private HandlerInterceptor2 handlerInterceptor2;
    @Autowired
    private HandlerInterceptor3 handlerInterceptor3;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(handlerInterceptor1).addPathPatterns("/**");
        registry.addInterceptor(handlerInterceptor2).addPathPatterns("/**");
        registry.addInterceptor(handlerInterceptor3).addPathPatterns("/**");
    }
}
